<template>
	<view>
		<view class="contentCla">
			<view class="titleCla">
				{{name.titleName}}
			</view>
			<view class="textCla">
				{{name.Content}}
			</view>
			<view class="boxCla">

				<view class="inputCla">
					<u-input maxlength="20" placeholder="搜索职位类别" border="bottom" v-model="obj.FullName">
						<view slot="prefix">
							<u-icon name="search" size="32" color="#C1C1C1"></u-icon>
						</view>
					</u-input>
				</view>

				<sortSelectionView v-if="!obj.FullName" @sortSelectionEmit="sortSelectionEvent"></sortSelectionView>

				<view class="bottomCla" v-else>
					<view class="itemCla" v-for="(item,index) in list" :key="index" @click="searchClick(item)">
						<view class="" v-html="$util.hightLight(item.FullName,obj.FullName,'#3476FE')">
							{{item.FullName}}
						</view>
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import sortSelectionView from "@/pages/component/addindex-page/sortSelection/index.vue"
	export default {
		data() {
			return {
				obj: {
					Id: [],
					FullName: '',
				},
				list: [],
				machlist: [],
			}
		},
		props: {
			name: {
				type: Object
			},
		},
		components: {
			sortSelectionView
		},
		watch: {
			'obj.FullName'(newVal) {
				if (newVal) {
					this.thirdList();
					this.hightLight();
				}
			}
		},
		created() {
			this.obj.FullName = this.name.PositionLab;
		},
		methods: {
			hightLight(val, editKeyword,color) {},
			chuanshuMet() {
				this.$emit('toguanjianciData', this.obj)
			},
			sortSelectionEvent(val) {
				this.obj = val;
				this.chuanshuMet();
			},
			thirdList() {
				this.$http.huirc.category_third({
					name: this.obj.FullName
				}).then((res) => {
					if (res.Success) {
						this.list = res.Result;
					}
				})
			},
			searchClick(item) {
				this.obj.FullName = item.FullName;
				this.obj.Id = item.CategoryIdTree.split(',');
				this.chuanshuMet();
			},
			hightLight() {
				this.list.forEach(item => {
					let obj = {
						FullName: this.$util.hightLight(this.obj.FullName, item.FullName)
					}

				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.contentCla {
		background-color: #fff;
		width: 100%;
		min-height: 100vh;

		.titleCla {
			padding: 60rpx 40rpx 10rpx 40rpx;
			font-size: 48rpx;
			font-weight: bold;
			color: #000000;
		}

		.textCla {
			padding: 0 40rpx 10rpx 40rpx;
			font-weight: 500;
			color: #666666;
			font-size: 28rpx;
		}

		.boxCla {
			padding: 20rpx 40rpx 0 40rpx;

			.inputCla {
				.suffixCla {
					display: flex;
					font-size: 26rpx;
					font-weight: 500;

					.text1Cla {
						color: #333333;
					}

					.text2Cla {
						color: #C1C1C1;
					}
				}
			}

			.bottomCla {
				margin-bottom: 20rpx;

				.itemCla {
					padding: 20rpx 0;
					border-bottom: 1rpx solid #E2E2E2;
				}
			}

			/deep/.u-input--no-radius {
				padding-bottom: 31rpx !important;
			}

			/deep/.uni-input-placeholder {
				font-size: 34rpx;
				font-weight: 400;
				color: #C1C1C1;
			}
		}

	}
</style>